package tables

import "peilian-api/app/global/variable"

type ApiLog struct {
	Model
	Type     string `gorm:"type:varchar(15);not null;comment:类型,hb(河北招聘网)"`
	Uri      string `gorm:"type:varchar(255);not null;comment:uri"`
	UserId   string `gorm:"type:varchar(64);not null;comment:传入的用户id"`
	UserName string `gorm:"type:varchar(255);not null;default:'';comment:传入的用户名称"`
	Phone    string `gorm:"type:varchar(11);not null;default:'';comment:用户手机号"`
	Info     string `gorm:"type:varchar(512);not null;default:''comment:客户信息表外键"`
}

func (ApiLog) TableName() string {
	return "api_log"
}

func (a *ApiLog) CreateApiLog(ai ApiLog) error {
	d := variable.DB.MySQL.Model(&a).Create(&ai)
	if d.Error != nil {
		return d.Error
	}
	return nil
}
